<template>
  <div>

  </div>
</template>

<script>
  export default {
    data() {
      return {};
    },

    methods: {
      check() {
        //获取选中的行
        const ids = this.$store.state.edit.ids;
        const selectedData = this.$store.state.main.selectedData;
        if (selectedData.length < 1) {
          this.$message.error("请至少勾选1条记录！");
          return;
        }

        let allServeCompanyIdMap = new Map();
        let allApplyUserIdMap = new Map();

        for (let i = 0; i < selectedData.length; i++) {
          let item = selectedData[i];
          allServeCompanyIdMap.set(item.serveCompanyId, item.serveCompanyId);
          allApplyUserIdMap.set(item.applyUserId, item.applyUserId);
        }
        if (allServeCompanyIdMap.size > 1) {
          this.$message.error("不同服务商的申请单不能合并打印！");
          return;
        }
        if (allApplyUserIdMap.size > 1) {
          this.$message.error("不同申请人的申请单不能合并打印！");
          return;
        }
        //校验通过，跳转至打印页面
        let url = "#/blank/finance__payapply__print?payApplyIds=" + ids;
        window.open(url);
      }
    },

    mounted() {
      this.check();
    }
  };
</script>


<style>

</style>
